package edu.ucla.cs.rpc.multicast.sequencer;

import java.io.IOException;
import java.net.SocketAddress;

import edu.ucla.cs.rpc.multicast.Dest;
import edu.ucla.cs.rpc.multicast.handlers.MessageHandler;
import edu.ucla.cs.rpc.multicast.handlers.NullMessageHandler;
import edu.ucla.cs.rpc.multicast.network.MulticastMessageReceiver;

/**
 * A Sequencer Destination receives Messages from the network and delivers them
 * to the given message handler.
 * 
 * @author Chase Covello Philip Russell
 * @see Total Order Broadcast and Multicast Algorithms: Taxonomy and Survery,
 *      Defago et al
 * @see Section 4.1, pages 12 - 13
 * 
 */
public class SequencerDest extends MulticastMessageReceiver implements Dest {

	/**
	 * Construct a new SequencerDest with the given multicast manager and a
	 * no-op message handler.
	 * 
	 * @param multicastManager
	 *            the multicast manager to join.
	 * @throws IOException
	 *             in the case of unrecoverable network errors.
	 */
	public SequencerDest(SocketAddress multicastManager) throws IOException {
		this(multicastManager, new NullMessageHandler());
	}

	/**
	 * Construct a new SequencerDest with the given mulicast manager and message
	 * handler.
	 * 
	 * @param multicastManager
	 *            the multicast manager to join.
	 * @param handler
	 *            the message handler to use.
	 * @throws IOException
	 *             in the case of unrecoverable network errors.
	 */
	public SequencerDest(SocketAddress multicastManager, MessageHandler handler)
			throws IOException {
		super(multicastManager, handler);
	}
}
